import 'package:hotpot/generated/json/base/json_convert_content.dart';
import 'package:hotpot/models/sale_order.dart';

SaleOrder $SaleOrderFromJson(Map<String, dynamic> json) {
	final SaleOrder saleOrder = SaleOrder();
	final int? id = jsonConvert.convert<int>(json['id']);
	if (id != null) {
		saleOrder.id = id;
	}
	final String? name = jsonConvert.convert<String>(json['name']);
	if (name != null) {
		saleOrder.name = name;
	}
	final String? state = jsonConvert.convert<String>(json['state']);
	if (state != null) {
		saleOrder.state = state;
	}
	final String? createDate = jsonConvert.convert<String>(json['create_date']);
	if (createDate != null) {
		saleOrder.createDate = createDate;
	}
	final String? signature = jsonConvert.convert<String>(json['signature']);
	if (signature != null) {
		saleOrder.signature = signature;
	}
	final List<String>? partnerInvoiceId = jsonConvert.convertListNotNull<String>(json['partner_invoice_id']);
	if (partnerInvoiceId != null) {
		saleOrder.partnerInvoiceId = partnerInvoiceId;
	}
	final List<String>? partnerShippingId = jsonConvert.convertListNotNull<String>(json['partner_shipping_id']);
	if (partnerShippingId != null) {
		saleOrder.partnerShippingId = partnerShippingId;
	}
	final double? amountUntaxed = jsonConvert.convert<double>(json['amount_untaxed']);
	if (amountUntaxed != null) {
		saleOrder.amountUntaxed = amountUntaxed;
	}
	final double? amountTax = jsonConvert.convert<double>(json['amount_tax']);
	if (amountTax != null) {
		saleOrder.amountTax = amountTax;
	}
	final double? amountTotal = jsonConvert.convert<double>(json['amount_total']);
	if (amountTotal != null) {
		saleOrder.amountTotal = amountTotal;
	}
	final String? invoiceStatus = jsonConvert.convert<String>(json['invoice_status']);
	if (invoiceStatus != null) {
		saleOrder.invoiceStatus = invoiceStatus;
	}
	final String? deliveryStatus = jsonConvert.convert<String>(json['delivery_status']);
	if (deliveryStatus != null) {
		saleOrder.deliveryStatus = deliveryStatus;
	}
	return saleOrder;
}

Map<String, dynamic> $SaleOrderToJson(SaleOrder entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['state'] = entity.state;
	data['create_date'] = entity.createDate;
	data['signature'] = entity.signature;
	data['partner_invoice_id'] =  entity.partnerInvoiceId;
	data['partner_shipping_id'] =  entity.partnerShippingId;
	data['amount_untaxed'] = entity.amountUntaxed;
	data['amount_tax'] = entity.amountTax;
	data['amount_total'] = entity.amountTotal;
	data['invoice_status'] = entity.invoiceStatus;
	data['delivery_status'] = entity.deliveryStatus;
	return data;
}